/**
 * 
 */
package com.py.credit.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

/**
 * @author dd
 *
 */
public interface RelateDao {

	/**
	 * @param dbId
	 * @return
	 */
	List<String> selectAssociationMetricCodesByDbId(@Param(value = "dbId") int dbId);

	/**
	 * @param dbId
	 * @return
	 */
	List<String> selectMajorMetricCodesByDbId(@Param(value = "dbId") int dbId);

	/**
	 * 
	 * @param tableName
	 * @param batchId
	 * @param majorMetricCodes
	 * @param limit
	 * @return
	 */
	List<Map<String, Object>> selectRecordsByTableName(@Param(value = "tableName") String tableName,
			@Param(value = "batchId") String batchId, @Param(value = "list") List<String> majorMetricCodes,
			@Param(value = "limit") int limit);

	/**
	 * @param dbId
	 * @param buildMatchWhereSql
	 * @return
	 */
	Map<String, String> selectMatchZooUnique(@Param(value = "dbId") int dbId,
			@Param(value = "condition") String buildMatchWhereSql);

	/**
	 * @param dbId
	 * @param tybm
	 * @return
	 */
	Map<String, String> selectUniqueValue(@Param(value = "dbId") int dbId, @Param(value = "tybm") String tybm);

	/**
	 * @param dbId
	 * @param tybm
	 * @param setColumn
	 */
	void updateZooUnique(@Param(value = "dbId") int dbId, @Param(value = "tybm") String tybm,
			@Param(value = "setColumn") String setColumn);

	/**
	 * @param datasourceId
	 * @param recordId
	 * @param tybm
	 * @return
	 */
	void updateRecord(@Param(value = "tableName") String tableName, @Param(value = "recordId") int recordId,
			@Param(value = "tybm") String tybm);

	/**
	 * @param resourceId
	 * @param tybm
	 */
	void addTybmCube(@Param(value = "tableName") String resourceId, @Param(value = "tybm") String tybm);

	/**
	 * @param recordId
	 * @param tableName
	 */
	void unableAuth(@Param(value = "recordId") int recordId, @Param(value = "tableName") String tableName);

	/**
	 * @param dbId
	 * @param majorMetricCodes
	 * @return
	 */
	int selectMajorMatchZooUniques(@Param(value = "dbId") int dbId, @Param(value = "condition") String matchWhereSql);

	/**
	 * @param dbId
	 * @param deptId
	 * @param tableId
	 * @param metricCodeSql
	 * @param metricValueSql
	 */
	void addZooRecord(@Param(value = "dbId") int dbId, @Param(value = "deptId") int deptId,
			@Param(value = "tableId") int tableId, @Param(value = "recordId") int recordId,
			@Param(value = "metricCodeSql") String metricCodeSql,
			@Param(value = "metricValueSql") String metricValueSql);

	/**
	 * @param tybm
	 * @param dbId
	 * @param metricCodeSql
	 * @param metricValueSql
	 */
	void addZooUnique(@Param(value = "tybm") String tybm, @Param(value = "dbId") int dbId,
			@Param(value = "metricCodeSql") String metricCodeSql,
			@Param(value = "metricValueSql") String metricValueSql);

	/**
	 * @return
	 */
	int selectUnableAuthZooRecord();

	/**
	 * @param resourceId
	 * @param tybm
	 * @return
	 */
	int selectTybmCubeCount(@Param(value = "resourceId") String resourceId, @Param(value = "tybm") String tybm);

	/**
	 * @param datasourceId
	 * @return
	 */
	List<String> selectCommonMetricCodesByDbId(@Param(value = "dbId") int dbId);

	/**
	 * @param qymc
	 * @return
	 */
	Integer selectConcernedSubjectId(@Param(value = "qymc") String qymc);

	Integer callProcedure(@Param(value = "batchId") String batchId, @Param(value = "tableName") String tableName,
			@Param(value = "rootId") String datasourceId, @Param(value = "tableId") String tableId,
			@Param(value = "deptId") String deptId);

	int selectWaitCountByBatchId(@Param(value = "tableName") String tableName,
			@Param(value = "batchId") String batchId);

	int selectUniqueCount(@Param(value = "dataSourceId") int datasourceId);

	void addDummyZooUnique(@Param(value = "dataSourceId") int datasourceId, @Param(value = "keyword") String keyword);

	void deleteDummyZooUnique(@Param(value = "dataSourceId") int datasourceId);

}
